package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 积分类型：1策划人调整积分 2消费积分 3转发积分 4订阅积分 5分销积分 6积分兑换 7积分订单退款
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum PointsTypeEnum {

    BUSINESS(1, "策划人调整积分"),
    CONSUME(2, "消费积分"),
    SHARE(3, "转发积分"),
    SUBSCRIBE(4, "订阅积分"),
    DISTRIBUTION(5, "分销积分"),
    EXCHANGE(6, "积分兑换"),
    EXCHANGE_REFUND(7, "积分订单退款"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    PointsTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static PointsTypeEnum typeOf(Integer value) {
        PointsTypeEnum[] values = PointsTypeEnum.values();
        for (PointsTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static PointsTypeEnum typeOf(String name) {
        PointsTypeEnum[] values = PointsTypeEnum.values();
        for (PointsTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
